

export const handleScan = (onActivityResult) => {
	try {
		const SCAN_CODE = 111
		var Intent = plus.android.importClass("android.content.Intent");
		var ComponentName = plus.android.importClass('android.content.ComponentName')
		var intent = new Intent();
		intent.setComponent(new ComponentName("com.fuiou.pay.fzgpos",
			"com.fuiou.pay.fzgpos.support.PosSupportActivity"));
			
		//老版本使用transName
		intent.putExtra('transName', '扫码');
		//新版本使用transType，推荐使用，老版本无法兼容这种方式，新版本支持以前的方式transName
		intent.putExtra('transType', SCAN_CODE);
		var main = plus.android.runtimeMainActivity();
		//设置原生界面返回后的回调操作
		
		main.startActivityForResult(intent, SCAN_CODE);
		main.onActivityResult = onActivityResult
	} catch (e) {
		throw e
		//TODO handle the exception
	}
}





export const handleScanXy = (onActivityResult) => {
	try {
		const SCAN_CODE = 111
		uni.scanCode({
			onlyFromCamera: true,
			scanType: ['qrCode', 'pdf417', 'barCode', 'datamatrix'],
			autoDecodeCharSet: true,
			success: (res) => {
				console.log(res);
				onActivityResult(res)
			},
			fail: (res) => {
				console.log("错误" + res);
				console.log(res);
			}
		})
	} catch (e) {
		throw e
		//TODO handle the exception
	}
}
